{
  "$schema" : "http://json-schema.org/draft/2019-09/schema#",
  "title" : "Invoice Posting Response",
  "type" : "object",
  "additionalProperties" : false,
  "properties" : {
    "identifier" : {
      "type" : "integer",
      "description" : "Unique identifier for each file that is produced or processed by CMP"
    },
    "version" : {
      "type" : "number",
      "minimum" : 1.1,
      "maximum" : 1.1,
      "description" : "The current version of the generic extract file. This must match the corresponding inbound file."
    },
    "interfaceCategory" : {
      "type" : "string",
      "enum" : [ "Billing" ],
      "description" : "CMP categorisation of the job associated with this file"
    },
    "interfaceType" : {
      "type" : "string",
      "enum" : [ "Invoice Posting S/L" ],
      "description" : "Sub-categorisation of the job"
    },
    "batchDateAndTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "Represents when a batch was created in CMP"
    },
    "extractDateAndTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "Represents when a generic CMP file was created from a batch"
    },
    "recordCount" : {
      "type" : "integer",
      "description" : "Number of records within the original batch"
    },
    "details" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Detail"
      },
      "description" : "Details of the invoice"
    }
  },
  "required" : [ "identifier", "version", "interfaceCategory", "interfaceType", "batchDateAndTime", "extractDateAndTime", "recordCount" ],
  "definitions" : {
    "Detail" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "detailSequence" : {
          "type" : "integer",
          "description" : "Unique sequence number for each batch detail under a particular batch header"
        },
        "accountNumber" : {
          "type" : "integer",
          "description" : "Account number of a particular customer"
        },
        "amount" : {
          "type" : "number",
          "minimum" : -9.9999999999E8,
          "maximum" : 9.999999999999E10,
          "description" : "Total amount of a particular ledger entry"
        },
        "invoiceType" : {
          "type" : "string",
          "enum" : [ "RI", "RM", "ZZ", "EMPTY" ],
          "description" : "Indication of whether an invoice is a credit or debit"
        },
        "invoiceNumber" : {
          "type" : "integer",
          "description" : "Unique number identifying a particular invoice"
        },
        "remark" : {
          "type" : "string",
          "maxLength" : 30,
          "description" : "Indication of whether an invoice is for a single subscription, multiple subscriptions or other charges"
        },
        "taxDate" : {
          "type" : "string",
          "format" : "date-time",
          "description" : "The tax date of an invoice"
        },
        "dueDate" : {
          "type" : "string",
          "format" : "date-time",
          "description" : "Date the invoice is due"
        },
        "ledgerReferenceType" : {
          "type" : "string",
          "enum" : [ "SALES_LEDGER", "GENERAL_LEDGER_TAX", "GENERAL_LEDGER_NOMINAL", "GENERAL_LEDGER_PARENT_ACCOUNT" ],
          "description" : "Indication of whether this is a sales ledger, general ledger or general ledger tax entry"
        },
        "ledgerReference" : {
          "type" : "string",
          "description" : "The reference value of a particular ledger entry"
        }
      },
      "required" : [ "detailSequence", "accountNumber", "amount", "invoiceType", "invoiceNumber", "remark", "taxDate", "dueDate", "ledgerReferenceType", "ledgerReference" ]
    }
  }
}